package ApplicationLogic.controllers;


import ApplicationLogic.modelMiscTools.DomainModelLister;
import ApplicationLogic.modelMiscTools.IChildModelInsertor;
import ApplicationLogic.modelMiscTools.ChildModelInsertor;
import ApplicationLogic.modelMiscTools.IDomainModelLister;
import ApplicationLogic.modelPersistence.DAOgenerico;
import ApplicationLogic.modelPersistence.IDAOTEMPLATE;
import ApplicationLogic.modelPersistence.IQueryFormer;
import ApplicationLogic.modelPersistence.QueryFormer;
import ApplicationLogic.modelSerialization.IModelSerializer;
import ApplicationLogic.modelSerialization.ModelSerializer;
import ApplicationLogic.modelValidation.IModelValidator;
import ApplicationLogic.modelValidation.ModelValidator;


public class InstancesPool {
/*
 * LA idea es lograr algo tipo IOC para poder cambiar las 
 * implementaciones a piaccere
 */
	
	IDAOTEMPLATE dao;
	IModelSerializer mSerializer;
	IModelValidator mValidator;
	IQueryFormer HQLformer;
	IDomainModelLister DomainModelLister;
	IChildModelInsertor ChildModelInsertor;
	static InstancesPool instance = null;
	
	
	private InstancesPool() 
	{
		//Here is where we can change implementations without any impact
		dao = DAOgenerico.getInstance();
		mSerializer = new ModelSerializer();
		mValidator = new ModelValidator();
		HQLformer = new QueryFormer();
		DomainModelLister = new DomainModelLister();
		ChildModelInsertor = new ChildModelInsertor();
	}

	public synchronized static InstancesPool getInstance() {
        if (instance == null) {
            instance = new InstancesPool();
        }
        return instance;
    }
	
	
	public void setDao(IDAOTEMPLATE dao) {
		this.dao = dao;
	}

	public void setmSerializer(IModelSerializer mSerializer) {
		this.mSerializer = mSerializer;
	}

	public void setmValidator(IModelValidator mValidator) {
		this.mValidator = mValidator;
	}

	public IDAOTEMPLATE getDao() {
		return dao;
	}

	public IModelSerializer getmSerializer() {
		return mSerializer;
	}

	public IModelValidator getmValidator() {
		return mValidator;
	}

	public IQueryFormer getHQLformer() {
		return HQLformer;
	}

	public void setHQLformer(IQueryFormer hQLformer) {
		HQLformer = hQLformer;
	}

	public IDomainModelLister getDomainModelLister() {
		return DomainModelLister;
	}

	public void setDomainModelLister(IDomainModelLister domainModelLister) {
		DomainModelLister = domainModelLister;
	}

	public IChildModelInsertor getChildModelInsertor() {
		// TODO Auto-generated method stub
		return ChildModelInsertor;
	}


	
}
